home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 98 / Skunkware 98.iso / src / interp / perl5.005.tar.gz / perl5.005.tar / perl5.005 / pod / rofftoc < prev    next >
Text File  |  1998-07-19  |  2KB  |  67 lines

  1. # feed this into perl
  2.     eval 'exec perl -S $0 ${1+"$@"}'
  3.         if $running_under_some_shell;
  4.  
  5. # Usage: rofftoc PerlTOC.xxx.raw
  6. #
  7. # Post-processes roffitall output. Called from roffitall to produce
  8. # a formatted table of contents.
  9. #
  10. # Author: Tom Christiansen
  11.  
  12. print <<'EOF';
  13. .de NP
  14. '.sp 0.8i
  15. .tl ''- % -''
  16. 'bp
  17. 'sp 0.5i
  18. .tl ''\fB\s+2Perl Table of Contents\s0\fR''
  19. 'sp 0.3i
  20. ..
  21. .wh -1i NP
  22. .af % i
  23. .sp 0.5i
  24. .tl ''\fB\s+5Perl Table of Contents\s0\fR''
  25. .sp 0.5i
  26. .nf
  27. .na
  28. EOF
  29. while (<>) {
  30.     #chomp;
  31.     s/Index://;
  32.     ($type, $page, $desc) = split ' ', $_, 3;
  33.     $desc =~ s/^"(.*)"$/$1/;
  34.     if      ($type eq 'Title') {
  35.     ($name = $desc) =~ s/ .*//;
  36.     next;
  37.     } elsif ($type eq 'Name') {
  38.     #print STDERR  $page, "\t", $desc;
  39.     print ".ne 5\n";
  40.     print ".in 0\n";
  41.     print ".sp\n";
  42.     print ".ft B\n";
  43.     print "$desc\n";
  44.     print ".ft P\n";
  45.     print ".in 5n\n";
  46.     } elsif ($type eq 'Header') {
  47.     print ".br\n", $page, "\t", $desc;
  48.     } elsif ($type eq 'Subsection') {
  49.     print ".br\n", $page, "\t\t", $desc;
  50.     } elsif ($type eq 'Item') {
  51.     next if $desc =~ /\\bu/;
  52.     next unless $name =~ /POSIX|func/i;
  53.     print ".br\n", $page, "\t\t\t", $desc;
  54.     }
  55. __END__
  56. Index:Title    1    "PERL 1"
  57. Index:Name    1    "perl - Practical Extraction and Report Language"
  58. Index:Header    1    "NAME"
  59. Index:Header    1    "SYNOPSIS"
  60. Index:Header    2    "DESCRIPTION"
  61. Index:Item    2    "\(bu Many usability enhancements"
  62. Index:Item    2    "\(bu Simplified grammar"
  63. Index:Item    2    "\(bu Lexical scoping"
  64. Index:Item    2    "\(bu Arbitrarily nested data structures"
  65. Index:Item    2    "\(bu Modularity and reusability"
  66.